// 社区管理模块的接口
import http from "@/utils/http";

// 专题列表接口
export function getTopicsListAPI() {
    return http({
        url: "/pet-adopt/community/topics",
    });
}

// 新增专题接口：-form表单数据
export function postNewTopicAPI(form) {
    return http({
        url: "/pet-adopt/community/topics",
        method: "post",
        data: form,
    });
}

// 修改专题接口
export function putUpdateTopicAPI(topicId, form) {
    return http({
        url: "/pet-adopt/community/topics/update",
        method: "put",
        params: { topicId },
        data: form,
    });
}

// 隐藏专题接口
export function putHideTopicAPI(topicId) {
    return http({
        url: "/pet-adopt/community/topics/hide",
        method: "put",
        params: {
            topicId,
        },
    });
}

// 文章列表接口
export function getArticleAPI(topicId) {
    return http({
        url: `/pet-adopt/community/topics/${topicId}`,
    });
}

// 新增文章接口
export function postAddArticle(form) {
    return http({
        url: "/pet-adopt/admin/article/add",
        method: "post",
        data: form,
    });
}

// 隐藏文章接口
export function postHideArticleAPI(articleId) {
    return http({
        url: `/pet-adopt/admin/article/${articleId}/hide`,
        method: "post",
    });
}

// 恢复文章接口
export function postRecoverArticleAPI(articleId) {
    return http({
        url: `/pet-adopt/admin/article/${articleId}/recover`,
        method: "post",
    });
}
